﻿Public Class clsProdInfo

    Public Function getProdInfoByStatus(status As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT prod_id,a.prod_spec_id,b.prod_spec_name,steel_seal_no,pq_jc_ope,pq_jc_dt FROM sf.b_prod_info a "
        szSql &= " left join sf.t_prod_spec b on a.prod_spec_id = b.prod_spec_id "
        szSql &= "WHERE a.factory_id = ? and a.status = ? and pq_jc_ope is not null and pq_jc_dt is not null"
        Return DBacs.ExecuteSql(szSql, -1, "TS", status)
    End Function

    Public Function getProdInfoByProdId(prod_id As String, status As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT a.prod_id,a.prod_spec_id,b.prod_spec_name,a.pgd_id,steel_seal_no,pq_jc_ope,pq_jc_dt,c.area FROM sf.b_prod_info a "
        szSql &= " left join sf.t_prod_spec b on a.prod_spec_id = b.prod_spec_id "
        szSql &= " left join sf.b_lx_ck c on a.prod_id = c.prod_id "
        szSql &= "WHERE a.factory_id = ? and a.prod_id = ? and a.status = ? and pq_jc_ope is not null and pq_jc_dt is not null"
        Return DBacs.ExecuteSql(szSql, -1, "TS", prod_id, status)
    End Function

    ''' <summary>
    ''' 查询制品信息
    ''' </summary>
    ''' <param name="prod_id">生产编号</param>
    ''' <returns>制品信息</returns>
    Friend Function selectProdInfo(prod_id As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT  * FROM sf.b_prod_info WHERE factory_id=? and prod_id = ? "
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", prod_id)
        If IsNothing(dt) Then
            selectProdInfo = New DataTable
        Else
            selectProdInfo = dt
        End If
    End Function

    Public Function getProdInfoById(prod_id As String, status As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT * FROM sf.b_prod_info WHERE factory_id=? and prod_id = ? and status = ? "
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", prod_id, status)
        If IsNothing(dt) Then
            getProdInfoById = New DataTable
        Else
            getProdInfoById = dt
        End If
    End Function

End Class
